﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DKPScoreWebApi.Models
{
    /// <summary>
    /// 微信用户实体类
    /// 存储微信小程序的用户基本信息
    /// </summary>
    public class WxUser
    {
        /// <summary>
        /// 用户ID，主键，自增
        /// </summary>
        [Key]
        public int Id { get; set; }

        /// <summary>
        /// 微信开放平台唯一标识符，用于关联微信用户
        /// </summary>
        [Required]
        [MaxLength(100)]
        public string OpenId { get; set; }

        /// <summary>
        /// 用户昵称，从微信获取
        /// </summary>
        [MaxLength(100)]
        public string Nickname { get; set; }

        /// <summary>
        /// 用户头像URL，从微信获取
        /// </summary>
        [MaxLength(500)]
        public string AvatarUrl { get; set; }

        /// <summary>
        /// 用户创建时间，记录用户首次使用系统的时间
        /// </summary>
        public DateTime CreatedAt { get; set; } = DateTime.Now;

        // 导航属性
        /// <summary>
        /// 用户管理的工会列表
        /// </summary>
        public virtual ICollection<GuildAdmin> GuildAdmins { get; set; }

        /// <summary>
        /// 用户创建的积分记录
        /// </summary>
        public virtual ICollection<PointRecord> CreatedRecords { get; set; }
    }
}
